Using Multiple Forms in a DataBlock

Introduction

Example 1 demonstrated how to create a Dashboard in which the input selections and query results are displayed on the same form.  There are situations where you will want to display report results on a different form than the form where input selections were made.  This can be accommodated in Argos and will be demonstrated in this example.

This simple example is used to quickly obtain contact information for an individual employee within a company.  A list of employees is presented from which the user can select one from the list.  The user can then choose which of the three types of contact information to display.  The type of contact and the location of the information in the sample database are shown in the table below.

Contact type Database table
Home address Employees
Phone (home and mobile) Employee_Phone
email Employee_Email
Emergency contact (name, relationship, phone) Employee_Emerg_Contact

This shows the Main Form that has been created.  It contains a list box in which employee names can be selected.  It also contains buttons labeled Address, Phone, Email, and Emergency Contact.

During execution of the form, the user selects an employee name from the multi-column list box, then clicks the appropriate button to display the type of contact information to be provided.  After clicking the button, another form will be displayed containing the corresponding contact information.

Five forms need to be created for this example.  The form above is named “Main”.  The remaining forms will be named “Address_Form”, “Phone_Form”, “Email_Form”, and “Emergency_Form”.

Create the DataBlock

The first step is to create a DataBlock and launch the DataBlock Designer, then click on the Forms tab. 

This shows the location of the Forms tab within the DataBlock Designer.

Add the Form Names

The default name of the form that appears when launching the DataBlock Designer is “Main” as shown in the above figure.  Click the blue plus button plus button to create the additional four forms.  The default names are Form1, Form2, Form3, and Form4.  Right-click on each form name and rename them to Address_Form, Phone_Form, Email_Form, and Emergency_Form as shown below. You can use the up and down arrows to reorder the forms on the tab.

This shows the Forms tab with all four of the forms added.

Click  “Main” under the Forms tab to design the main form.

Note: Newly created forms inherit the font, properties, and color configurations of whichever form appears at the top of the Forms list. Changing the order of forms does not affect this behavior. The copy function will still copy all properties of whichever form you have selected to copy.


Create the Main Form

Within the DataBlock Designer, create the main form containing a multi-column list box for the employee names using the same method as in Example 1.  Then create button objects named  Address_button, Phone_button, Email_button, and Emergency_button. 

Edit Properties of the Buttons

The properties for the Address button are as follows:
The properties pane within the DataBlock Designer for the Address Button.

Note the Variable Name property is set to “Address_button”, which is the name of the button object. Similarly, the Text property is set to “Address”, which is the text displayed on the button.

When the report is executed, we want to launch the Address form when the Address button is clicked. The Address form will show the address information for the selected employee on the main form. The On Click property is used to execute the appropriate form when this button is clicked.

Click in the On Click property, then click the ellipses button ellipses button to launch the Edit Event dialog.

The Edit Event dialog allows you to select which form to present when this button is clicked.  Select "Address_Form" to launch the Address Form when the Address button is clicked.

The On Click Property: This property is available for buttons, shape objects, static labels, graphics, and chart objects.

The Edit Event dialog box where an event is associated with a button.

Note that various events can be activated by the "On Click" event.  For this example only the “Activate Form” event is used.  Click the Help button to see a description of all event types.

Repeat this process for each of the buttons. 

Once you have set the properties for the remaining buttons, the final step is to create the form for each button.


Create the form/query associated with each button

To create the Address form:

  1. Click on the Forms tab within the DataBlock Designer, then
  2. Select the Address form. 
  3. The Design Area of the DataBlock Designer will be blank.  You can now place a multi-column list box object multi column listbox icon on the toolbar to contain the results of the query. 
  4. Use the Employees Table for the query, and include the desired fields ('last_name', 'first_name', 'Street', 'City', 'State', and 'Zip').
    The design of the address form within the DataBlock Designer. There is a multi column listbox on the form. That listbox has been linked to an s q l query for employee first and last name and all parts of the employee address.
  5. After the query for the Address form is complete, click on the “Phone_form” form in the Forms tab to design the form to display employee phone numbers. 
  6. Again, you will see the Design Area blank.  As was done above, create a multi-column list box to contain the phone numbers obtained from the Employee_Phone table. 
  7. You will need to join the Employees table with the Employee_Phone table and create a WHERE clause such that the query finds the phone number only for the employee selected on the Main Form. 
  8. Repeat this procedure to create the forms for the Email and Emergency buttons.


Summary

The multi-form creation process is now complete.  Buttons were created to activate associated forms, and each type of query result is displayed on its own form.

To show how the above report design appears during execution, the figure below shows Bill Brown as the employee selected.

This shows the selection of Employee Name in the DataBlock form.  Bill Brown is the employee name selected.

After clicking the Phone button, the following report is displayed on the Phone form, and lists the various phone numbers for Bill Brown.

This image shows the query results and lists three phone numbers for the selected employee.

Tip: You can also use tabs to navigate between forms instead of buttons. See Form Design - Form Properties for a description of how the Is Tab property is used to created a tabbed interface.